package com.pdg.android.splorr.data.enums;

import com.pdg.android.splorr.R;
import com.pdg.android.splorr.Utilities;

public enum ArmorType {
	NONE(0,0,0,0.0,null,null),
	HELMET(R.string.item_name_helmet,10,1,0.1,new EquipSlot[]{EquipSlot.HEAD},new RoomState[]{RoomState.NONE}),
	SHIELD(R.string.item_name_shield,25,1,0.05,new EquipSlot[]{EquipSlot.OFF_HAND},new RoomState[]{RoomState.NONE}),
	CHAINMAIL(R.string.item_name_chainmail,25,1,0.05,new EquipSlot[]{EquipSlot.CHEST},new RoomState[]{RoomState.NONE}),
	PLATEMAIL(R.string.item_name_platemail,50,2,0.025,new EquipSlot[]{EquipSlot.CHEST},new RoomState[]{RoomState.NONE});
	private int durability;
	private int defenseValue;
	private int stringId;
	private EquipSlot[] equipSlots;
	private double frequency;
	private RoomState[] roomStates;
	ArmorType(int theStringId,int theDurability,int theDefenseValue,double theFrequency,EquipSlot[] theEquipSlots,RoomState[] theRoomStates){
		setStringId(theStringId);
		setEquipSlots(theEquipSlots);
		setDefenseValue(theDefenseValue);
		setDurability(theDurability);
		setFrequency(theFrequency);
		setRoomStates(theRoomStates);
	}
	private void setRoomStates(RoomState[] theRoomStates) {
		roomStates = theRoomStates;
	}
	private void setFrequency(double theFrequency) {
		frequency = theFrequency;
	}
	private void setDurability(int theDurability) {
		durability = theDurability;
	}
	private void setDefenseValue(int theDefenseValue) {
		defenseValue = theDefenseValue;
	}
	private void setEquipSlots(EquipSlot[] theEquipSlots){
		equipSlots = theEquipSlots;
	}
	public EquipSlot[] getEquipSlots(){
		return equipSlots;
	}
	private void setStringId(int theStringId){
		stringId = theStringId;
	}
	public int getStringId(){
		return stringId;
	}
	public int getDurability(){
		return durability;
	}
	public int getDefenseValue(){
		return defenseValue;
	}
	public double getFrequency(){
		return frequency;
	}
	public RoomState[] getRoomStates(){
		return roomStates;
	}
	public boolean checkRoomState(RoomState theRoomState){
		for(RoomState temp:getRoomStates()){
			if(temp==theRoomState){
				return true;
			}
		}
		return false;
	}
	public int generateDurability() {
		return Utilities.roll(getDurability()/2,getDurability());
	}
}
